package com.sky.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sky.dto.DishPageQueryDTO;
import com.sky.po.DishPO;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface DishRepository extends BaseMapper<DishPO> {
    /**
     * 菜品分页查询
     * @param source
     * @return
     */
    Page<DishVO> page(@Param("page")Page<DishVO> page,@Param("source") DishPageQueryDTO source);

    /**
     * 根据菜品分类id查询菜品
     */
    List<DishVO> getDishByCategoryId(@Param("id")Long id);

    /**
     * 根据套餐id联立套餐菜品表查询菜品数据
     * @param setmealId
     * @return
     */
    List<DishPO> selectBySetmealId(@Param("id") Long setmealId);

    /**
     * 根据条件统计菜品数量
     * @param map
     * @return
     */
    Integer countByMap(Map map);
}
